<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8"/>
    <title>发票</title>
    <style>
        body {
            font-family: 'SimSun', sans-serif;
            margin: 0;
            padding: 20px;
            background-color: #f9f9f9;
        }

        .invoice-container {
            background-color: #fff;
            padding: 30px;
            border: 1px solid #ddd;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
        }

        h1 {
            text-align: center;
            font-size: 24px;
            border-bottom: 2px solid #000;
            padding-bottom: 10px;
            margin-bottom: 20px;
        }

        .header, .footer {
            text-align: center;
            margin-bottom: 20px;
        }

        .header p, .footer p {
            margin: 5px 0;
            font-size: 14px;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 20px;
        }

        th, td {
            border: 1px solid #ddd;
            padding: 8px;
            text-align: left;
            font-size: 14px;
        }

        th {
            background-color: #f2f2f2;
        }

        .total {
            font-weight: bold;
            font-size: 16px;
        }

        h2 {
            font-size: 18px;
            margin-top: 20px;
            margin-bottom: 10px;
            border-bottom: 1px solid #ddd;
            padding-bottom: 5px;
        }

        .footer {
            margin-top: 30px;
            font-size: 12px;
            color: #888;
        }
    </style>
</head>
<body>
<div class="invoice-container">
    <div class="header">
        <img th:src="@{image/logo.svg}" alt="logo" />
        <h1>发票</h1>
        <p>发票编号：<span th:text="${invoiceNumber}"></span></p>
        <p>开具日期：<span th:text="${invoiceDate}"></span></p>
    </div>

    <h2>买家信息</h2>
    <p>买家姓名：<span th:text="${buyerName}"></span></p>
    <p>买家邮箱：<span th:text="${buyerEmail}"></span></p>
    <p>买家地址：<span th:text="${buyerAddress}"></span></p>

    <h2>卖家信息</h2>
    <p>卖家名称：<span th:text="${sellerName}"></span></p>
    <p>卖家联系方式：<span th:text="${sellerContact}"></span></p>

    <h2>商品详情</h2>
    <table>
        <thead>
        <tr>
            <th>商品名称</th>
            <th>商品编码</th>
            <th>数量</th>
            <th>单价 (元)</th>
            <th>小计 (元)</th>
        </tr>
        </thead>
        <tbody>
        <tr th:each="item : ${goodsItems}">
            <td th:text="${item.goodsName}"></td>
            <td th:text="${item.goodsCode}"></td>
            <td th:text="${item.quantity}"></td>
            <td th:text="${item.unitPrice}"></td>
            <td th:text="${item.totalPrice}"></td>
        </tr>
        </tbody>
    </table>

    <h2>费用汇总</h2>
    <p>总金额：<span th:text="${totalAmount}"></span> 元</p>
    <p>税费：<span th:text="${taxAmount}"></span> 元</p>
    <p>折扣：<span th:text="${discountAmount}"></span> 元</p>
    <p class="total">最终金额：<span th:text="${finalAmount}"></span> 元</p>

    <h2>付款信息</h2>
    <p>付款方式：<span th:text="${paymentMethod}"></span></p>
    <p>订单号：<span th:text="${orderNumber}"></span></p>

    <div class="footer">
        <p>感谢您的购买！如有问题，请联系我们。</p>
    </div>
</div>
</body>
</html>
